<?php
/**
 * 搜索引擎模型 - 核心应用
 * @author jason <yangjs17@yeah.net> 
 * @version TS3.0
 */
class HealthReportModel extends Model {

	protected $tableName = 'health_report';
	protected $fields	= array(
		0=>'rpt_id',
		1=>'rpt_name',
		2=>'type',
		3=>'fid',
		4=>'attach_id',
		5=>'detailed_info',
		6=>'comment',
		7=>'status',
		8=>'time',
		9=>'year',
		10=>'test_type',
		11=>'is_report',
		12=>'advice_img',
	);
	public function addHeathReport($data,$test_id){
		$rpt_name=$this->_getReportName($data,5);
		$report_data=array(
			'year'=>$data["year"],
			'test_type'=>$data["test_number"],
			'type'=>5,
			'is_report'=>$data['is_report'],
			'fid'=>$data['stu_id'],
		);
		//判断是否生成报告，如果没有生成报告才生成相应报告
		if(!$this->where($report_data)->find()){
			$report_data["rpt_name"]=$rpt_name;
			if($rpt_id=$this->add($report_data)){
				M("report_data")->add(array("tid"=>$test_id,'rpt_id'=>$rpt_id));
				$stu=$this->_getStudentInfo($data["stu_id"]);
				$class=$this->_getClassInfo($stu["class_id"]);
				$school=$this->_getSchoolInfo($class["school_id"]);
				$area=$this->_getAreaInfo($school["fid"]);
				$city=$this->_getAreaInfo($area["fid"]);
				$this->_addOtherReport($data,$test_id,$class["class_id"],4);
				$this->_addOtherReport($data,$test_id,$school["fid"],3);
				if($data['is_report']==1){
					$this->_addOtherReport($data,$test_id,$area["fid"],2);
					$this->_addOtherReport($data,$test_id,$city["fid"],1);
				}
			}
		}
	}
	//判断该学生所在的市区园班级账号是否生成报告
	private function _addOtherReport($data,$test_id,$fid,$type){
		$map=array(
			'year'=>$data['year'],
			'test_type'=>$data['test_number'],
			'type'=>$type,
			'fid'=>$fid,
			'is_report'=>$data['is_report'],
		);
		$rpt=$this->where($map)->find();
		if($rpt){
			M("report_data")->add(array("tid"=>$test_id,'rpt_id'=>$rpt['rpt_id']));
		}else{
			$map["rpt_name"]=$this->_getReportName($data,$type);
			if($rpt_id=$this->add($map)){
				M("report_data")->add(array("tid"=>$test_id,'rpt_id'=>$rpt_id));
			}
		}
	}
	//通过学生/测试时间获取报告名称例：2015阳关幼儿园小二班大大春季报告
	private function _getReportName($data,$type){
		$name=$this->_getName($data['stu_id'],$type);
		if($data['is_report']==1){
			if($data['test_number']==1){
				$test_number="春季"; 
			}else{
				$test_number="秋季"; 
			}
		}else{
			$test_number="第".$data['test_number']."次测试"; 
		}
		return $data['year'].$name.$test_number."报告";
	}
	//获取市/区/园/班/学生名称
	private function _getName($uid,$type){
		$stu=$this->_getStudentInfo($uid);
		$class=$this->_getClassInfo($stu["class_id"]);
		$school=$this->_getSchoolInfo($class["school_id"]);
		$school_user=$this->_getAreaInfo($school["fid"]);
		$area=$this->_getAreaInfo($school_user["fid"]);
		$city=$this->_getAreaInfo($area["fid"]);
		switch ($type) {
			case 1:
				$name=$city["location"];
				break;
			case 2:
				$name=$area["location"];
				break;
			case 3:
				$name=$area["location"].$school["name"];
				break;
			case 4:
				$name=$area["location"].$class["class_name"];
				break;
			case 5:
				$name=$area["location"].$class["class_name"].$stu["stu_name"];
				break;
			default:
				$name="";
			break;
		}
		return $name;
	}
	//获取班级报告名称
	public function getGradeReportName($class_id,$type,$test_number){
		$class=$this->_getClassInfo($class_id);
		$school=$this->_getSchoolInfo($class["school_id"]);
		$school_user=$this->_getAreaInfo($school["fid"]);
		$area=$this->_getAreaInfo($school_user["fid"]);
		$name=$area["location"].$class["class_name"];
		if($type==1){
			if($test_number==1){
				$name.="春季"; 
			}else{
				$name.="秋季"; 
			}
		}else{
			$name.="第".$test_number."次测试"; 
		}
		return $name."报告";
	}
	//获取市/区级报告的相关地区
	public function getReportData($year,$arr,$type,$report_type){
		$sum_number=0;
		$effective_number=0;
		$invalid_number=0;
		$report=array();
		$physicallevel=array(array(0,0,0),array(0,0,0),array(0,0,0),array(0,0,0),array(0,0,0));
		$age=array(array(0,0,0,0),array(0,0,0,0),array(0,0,0,0),array(0,0,0,0),array(0,0,0,0));
		$height_sum=0;
		$height=array(array(0,0,0,0,0,0,0),array(0,0,0,0,0,0,0),array(0,0,0,0,0,0,0),array(0,0,0,0,0,0,0),array(0,0,0,0,0,0,0),array(0,0,0,0,0,0,0),array(0,0,0,0,0,0,0),array(0,0,0,0,0,0,0),array(0,0,0,0,0,0,0),array(0,0,0,0,0,0,0),array(0,0,0,0,0,0,0));
		$weight_sum=0;
		$weight=array(array(0,0,0,0,0,0,0),array(0,0,0,0,0,0,0),array(0,0,0,0,0,0,0),array(0,0,0,0,0,0,0),array(0,0,0,0,0,0,0),array(0,0,0,0,0,0,0),array(0,0,0,0,0,0,0),array(0,0,0,0,0,0,0),array(0,0,0,0,0,0,0),array(0,0,0,0,0,0,0),array(0,0,0,0,0,0,0));
		$continuousJump=array(array(0,0,0,0,0,0,0),array(0,0,0,0,0,0,0),array(0,0,0,0,0,0,0),array(0,0,0,0,0,0,0),array(0,0,0,0,0,0,0),0);
		$balanceBeam=array(array(0,0,0,0,0,0,0),array(0,0,0,0,0,0,0),array(0,0,0,0,0,0,0),array(0,0,0,0,0,0,0),array(0,0,0,0,0,0,0),0);
		$flexion=array(array(0,0,0,0,0,0,0),array(0,0,0,0,0,0,0),array(0,0,0,0,0,0,0),array(0,0,0,0,0,0,0),array(0,0,0,0,0,0,0),0);
		$standing_long_jump=array(array(0,0,0,0,0,0,0),array(0,0,0,0,0,0,0),array(0,0,0,0,0,0,0),array(0,0,0,0,0,0,0),array(0,0,0,0,0,0,0),0);
		$reentry_run=array(array(0,0,0,0,0,0,0),array(0,0,0,0,0,0,0),array(0,0,0,0,0,0,0),array(0,0,0,0,0,0,0),array(0,0,0,0,0,0,0),0);
		$tennis_throw=array(array(0,0,0,0,0,0,0),array(0,0,0,0,0,0,0),array(0,0,0,0,0,0,0),array(0,0,0,0,0,0,0),array(0,0,0,0,0,0,0),0);
		$heartrate=array(array(0,0,0,0,0,0,0),array(0,0,0,0,0,0,0),array(0,0,0,0,0,0,0),0);
		$data=array();
		$user=model("User")->getUserInfo($arr['fid']);
		if($type==1){
			$where['city']=$user['city'];
		}
		if($type==2){
			$where['area']=$user['area'];
		}
		if($type==3){
			$where['fid']=$user['uid'];
		}
		$id=M("school")->where($where)->field("id")->findAll();
        $id = getSubByKey($id,'id');
        $map["school_id"]=array('in' , $id);

        //优化代码
        $sql = 'select s.stu_id,s.birth_condition,s.gender,s.birthday,t.heart_rate,t.date,t.height,t.weight,t.reentry_run,t.standing_long_jump,t.tennis_throw,t.continuousJump,t.flexion,t.balanceBeam from '.C('DB_PREFIX').'student s , '.C('DB_PREFIX').'test_data t where s.stu_id=t.stu_id and t.year='.$year .' and t.test_number='.$arr['test_type'].' and t.is_report=1 and s.school_id in(' . trim(implode(',' , $id),',') . ')';
        $student = M()->query($sql);

  //       $student = D("student")->where($map)->field('stu_id,birth_condition,gender,birthday')->findAll();
  //       $where1="";
		// foreach ($student as $key => $value) {
		// 	$where=array(
  //               'year'=>$year,
  //               'test_number'=>$arr['test_type'],
  //               'stu_id'=>$value['stu_id'],
  //               'is_report'=>1
  //           );
  //           $TestData= D("TestData")->where($where)->find();
  //           $where1.=D("TestData")->getLastSql()."<br/>";
  //          	$student[$key]["test_data"]=$TestData; 
		// }
		foreach ($student as $key => $value) {
        	$sum_number++;
            $report_result=model("CalculationMethod")->getDeterminationStandard($student[$key],$value["gender"],$value["birthday"]);
            //将判断依据存储用于另外判断
            $report_result["gender"]=$value["gender"];
            $report_result["birthday"]=$value["birthday"];
            $report_result["heart_rate"]=$value['heart_rate'];
            $report_result["birth_condition"]=$value["birth_condition"];
            $report[]=$report_result;
            // 判断开始
            if($report_result["result"]>0){
                if($report_type==3){
                    if($report_result['is_obesity']==5){
                        $effective_number++;
                        $height_sum++;
                        $weight_sum++;
                        if($value["heart_rate"]<80){
                            $heartrate[0][0]++;
                            if($value["gender"]==1){
                                $heartrate[0][1]++;
                            }else{
                                $heartrate[0][2]++;
                            }
                            if($report_result["age"]>=3 && $report_result["age"]<4){
                                $heartrate[0][3]++;
                            }else if($report_result["age"]>=4 && $report_result["age"]<5){
                                $heartrate[0][4]++;
                            }else if($report_result["age"]>=5){
                                $heartrate[0][5]++;
                            }else{
                                $heartrate[0][6]++;
                            }
                        }
                        if($value["heart_rate"]>=80 && $value["heart_rate"]<=120){
                            $heartrate[1][0]++;
                            if($value["gender"]==1){
                                $heartrate[1][1]++;
                            }else{
                                $heartrate[1][2]++;
                            }
                            if($report_result["age"]>=3 && $report_result["age"]<4){
                                $heartrate[1][3]++;
                            }else if($report_result["age"]>=4 && $report_result["age"]<5){
                                $heartrate[1][4]++;
                            }else if($report_result["age"]>=5){
                                $heartrate[1][5]++;
                            }else{
                                $heartrate[1][6]++;
                            }
                        }
                        if($value["heart_rate"]>120){
                            $heartrate[2][0]++;
                            if($value["gender"]==1){
                                $heartrate[2][1]++;
                            }else{
                                $heartrate[2][2]++;
                            }
                            if($report_result["age"]>=3 && $report_result["age"]<4){
                                $heartrate[2][3]++;
                            }else if($report_result["age"]>=4 && $report_result["age"]<5){
                                $heartrate[2][4]++;
                            }else if($report_result["age"]>=5){
                                $heartrate[2][5]++;
                            }else{
                                $heartrate[2][6]++;
                            }
                        }
                        if($report_result["standing_long_jump"]==1){
                            $standing_long_jump[0][0]++;
                            if($value["gender"]==1){
                                $standing_long_jump[0][1]++;
                            }else{
                                $standing_long_jump[0][2]++;
                            }
                            if($report_result["age"]>=3 && $report_result["age"]<4){
                                $standing_long_jump[0][3]++;
                            }else if($report_result["age"]>=4 && $report_result["age"]<5){
                                $standing_long_jump[0][4]++;
                            }else if($report_result["age"]>=5){
                                $standing_long_jump[0][5]++;
                            }else{
                                $standing_long_jump[0][6]++;
                            }
                        }
                        if($report_result["standing_long_jump"]==2){
                            $standing_long_jump[1][0]++;
                            if($value["gender"]==1){
                                $standing_long_jump[1][1]++;
                            }else{
                                $standing_long_jump[1][2]++;
                            }
                            if($report_result["age"]>=3 && $report_result["age"]<4){
                                $standing_long_jump[1][3]++;
                            }else if($report_result["age"]>=4 && $report_result["age"]<5){
                                $standing_long_jump[1][4]++;
                            }else if($report_result["age"]>=5){
                                $standing_long_jump[1][5]++;
                            }else{
                                $standing_long_jump[1][6]++;
                            }
                        }
                        if($report_result["standing_long_jump"]==3){
                            $standing_long_jump[2][0]++;
                            if($value["gender"]==1){
                                $standing_long_jump[2][1]++;
                            }else{
                                $standing_long_jump[2][2]++;
                            }
                            if($report_result["age"]>=3 && $report_result["age"]<4){
                                $standing_long_jump[2][3]++;
                            }else if($report_result["age"]>=4 && $report_result["age"]<5){
                                $standing_long_jump[2][4]++;
                            }else if($report_result["age"]>=5){
                                $standing_long_jump[2][5]++;
                            }else{
                                $standing_long_jump[2][6]++;
                            }
                        }
                        if($report_result["standing_long_jump"]==4){
                            $standing_long_jump[3][0]++;
                            if($value["gender"]==1){
                                $standing_long_jump[3][1]++;
                            }else{
                                $standing_long_jump[3][2]++;
                            }
                            if($report_result["age"]>=3 && $report_result["age"]<4){
                                $standing_long_jump[3][3]++;
                            }else if($report_result["age"]>=4 && $report_result["age"]<5){
                                $standing_long_jump[3][4]++;
                            }else if($report_result["age"]>=5){
                                $standing_long_jump[3][5]++;
                            }else{
                                $standing_long_jump[3][6]++;
                            }
                        }
                        if($report_result["standing_long_jump"]==5){
                            $standing_long_jump[4][0]++;
                            if($value["gender"]==1){
                                $standing_long_jump[4][1]++;
                            }else{
                                $standing_long_jump[4][2]++;
                            }
                            if($report_result["age"]>=3 && $report_result["age"]<4){
                                $standing_long_jump[4][3]++;
                            }else if($report_result["age"]>=4 && $report_result["age"]<5){
                                $standing_long_jump[4][4]++;
                            }else if($report_result["age"]>=5){
                                $standing_long_jump[4][5]++;
                            }else{
                                $standing_long_jump[4][6]++;
                            }
                        }
                        if($report_result["reentry_run"]==1){
                            $reentry_run[0][0]++;
                            if($value["gender"]==1){
                                $reentry_run[0][1]++;
                            }else{
                                $reentry_run[0][2]++;
                            }
                            if($report_result["age"]>=3 && $report_result["age"]<4){
                                $reentry_run[0][3]++;
                            }else if($report_result["age"]>=4 && $report_result["age"]<5){
                                $reentry_run[0][4]++;
                            }else if($report_result["age"]>=5){
                                $reentry_run[0][5]++;
                            }else{
                                $reentry_run[0][6]++;
                            }
                        }
                        if($report_result["reentry_run"]==2){
                            $reentry_run[1][0]++;
                            if($value["gender"]==1){
                                $reentry_run[1][1]++;
                            }else{
                                $reentry_run[1][2]++;
                            }
                            if($report_result["age"]>=3 && $report_result["age"]<4){
                                $reentry_run[1][3]++;
                            }else if($report_result["age"]>=4 && $report_result["age"]<5){
                                $reentry_run[1][4]++;
                            }else if($report_result["age"]>=5){
                                $reentry_run[1][5]++;
                            }else{
                                $reentry_run[1][6]++;
                            }
                        }
                        if($report_result["reentry_run"]==3){
                            $reentry_run[2][0]++;
                            if($value["gender"]==1){
                                $reentry_run[2][1]++;
                            }else{
                                $reentry_run[2][2]++;
                            }
                            if($report_result["age"]>=3 && $report_result["age"]<4){
                                $reentry_run[2][3]++;
                            }else if($report_result["age"]>=4 && $report_result["age"]<5){
                                $reentry_run[2][4]++;
                            }else if($report_result["age"]>=5){
                                $reentry_run[2][5]++;
                            }else{
                                $reentry_run[2][6]++;
                            }
                        }
                        if($report_result["reentry_run"]==4){
                            $reentry_run[3][0]++;
                            if($value["gender"]==1){
                                $reentry_run[3][1]++;
                            }else{
                                $reentry_run[3][2]++;
                            }
                            if($report_result["age"]>=3 && $report_result["age"]<4){
                                $reentry_run[3][3]++;
                            }else if($report_result["age"]>=4 && $report_result["age"]<5){
                                $reentry_run[3][4]++;
                            }else if($report_result["age"]>=5){
                                $reentry_run[3][5]++;
                            }else{
                                $reentry_run[3][6]++;
                            }
                        }
                        if($report_result["reentry_run"]==5){
                            $reentry_run[4][0]++;
                            if($value["gender"]==1){
                                $reentry_run[4][1]++;
                            }else{
                                $reentry_run[4][2]++;
                            }
                            if($report_result["age"]>=3 && $report_result["age"]<4){
                                $reentry_run[4][3]++;
                            }else if($report_result["age"]>=4 && $report_result["age"]<5){
                                $reentry_run[4][4]++;
                            }else if($report_result["age"]>=5){
                                $reentry_run[4][5]++;
                            }else{
                                $reentry_run[4][6]++;
                            }
                        }
                    if($report_result["flexion"]==1){
                        $flexion[0][0]++;
                        if($value["gender"]==1){
                            $flexion[0][1]++;
                        }else{
                            $flexion[0][2]++;
                        }
                        if($report_result["age"]>=3 && $report_result["age"]<4){
                            $flexion[0][3]++;
                        }else if($report_result["age"]>=4 && $report_result["age"]<5){
                            $flexion[0][4]++;
                        }else if($report_result["age"]>=5){
                            $flexion[0][5]++;
                        }else{
                            $flexion[0][6]++;
                        }
                    }
                    if($report_result["flexion"]==2){
                        $flexion[1][0]++;
                        if($value["gender"]==1){
                            $flexion[1][1]++;
                        }else{
                            $flexion[1][2]++;
                        }
                        if($report_result["age"]>=3 && $report_result["age"]<4){
                            $flexion[1][3]++;
                        }else if($report_result["age"]>=4 && $report_result["age"]<5){
                            $flexion[1][4]++;
                        }else if($report_result["age"]>=5){
                            $flexion[1][5]++;
                        }else{
                            $flexion[1][6]++;
                        }
                    }
                    if($report_result["flexion"]==3){
                        $flexion[2][0]++;
                        if($value["gender"]==1){
                            $flexion[2][1]++;
                        }else{
                            $flexion[2][2]++;
                        }
                        if($report_result["age"]>=3 && $report_result["age"]<4){
                            $flexion[2][3]++;
                        }else if($report_result["age"]>=4 && $report_result["age"]<5){
                            $flexion[2][4]++;
                        }else if($report_result["age"]>=5){
                            $flexion[2][5]++;
                        }else{
                            $flexion[2][6]++;
                        }
                    }
                    if($report_result["flexion"]==4){
                        $flexion[3][0]++;
                        if($value["gender"]==1){
                            $flexion[3][1]++;
                        }else{
                            $flexion[3][2]++;
                        }
                        if($report_result["age"]>=3 && $report_result["age"]<4){
                            $flexion[3][3]++;
                        }else if($report_result["age"]>=4 && $report_result["age"]<5){
                            $flexion[3][4]++;
                        }else if($report_result["age"]>=5){
                            $flexion[3][5]++;
                        }else{
                            $flexion[3][6]++;
                        }
                    }
                    if($report_result["flexion"]==5){
                        $flexion[4][0]++;
                        if($value["gender"]==1){
                            $flexion[4][1]++;
                        }else{
                            $flexion[4][2]++;
                        }
                        if($report_result["age"]>=3 && $report_result["age"]<4){
                            $flexion[4][3]++;
                        }else if($report_result["age"]>=4 && $report_result["age"]<5){
                            $flexion[4][4]++;
                        }else if($report_result["age"]>=5){
                            $flexion[4][5]++;
                        }else{
                            $flexion[4][6]++;
                        }
                    }
                    if($report_result["tennis_throw"]==1){
                        $tennis_throw[0][0]++;
                        if($value["gender"]==1){
                            $tennis_throw[0][1]++;
                        }else{
                            $tennis_throw[0][2]++;
                        }
                        if($report_result["age"]>=3 && $report_result["age"]<4){
                            $tennis_throw[0][3]++;
                        }else if($report_result["age"]>=4 && $report_result["age"]<5){
                            $tennis_throw[0][4]++;
                        }else if($report_result["age"]>=5){
                            $tennis_throw[0][5]++;
                        }else{
                            $tennis_throw[0][6]++;
                        }
                    }
                    if($report_result["tennis_throw"]==2){
                        $tennis_throw[1][0]++;
                        if($value["gender"]==1){
                            $tennis_throw[1][1]++;
                        }else{
                            $tennis_throw[1][2]++;
                        }
                        if($report_result["age"]>=3 && $report_result["age"]<4){
                            $tennis_throw[1][3]++;
                        }else if($report_result["age"]>=4 && $report_result["age"]<5){
                            $tennis_throw[1][4]++;
                        }else if($report_result["age"]>=5){
                            $tennis_throw[1][5]++;
                        }else{
                            $tennis_throw[1][6]++;
                        }
                    }
                    if($report_result["tennis_throw"]==3){
                        $tennis_throw[2][0]++;
                        if($value["gender"]==1){
                            $tennis_throw[2][1]++;
                        }else{
                            $tennis_throw[2][2]++;
                        }
                        if($report_result["age"]>=3 && $report_result["age"]<4){
                            $tennis_throw[2][3]++;
                        }else if($report_result["age"]>=4 && $report_result["age"]<5){
                            $tennis_throw[2][4]++;
                        }else if($report_result["age"]>=5){
                            $tennis_throw[2][5]++;
                        }else{
                            $tennis_throw[2][6]++;
                        }
                    }
                    if($report_result["tennis_throw"]==4){
                        $tennis_throw[3][0]++;
                        if($value["gender"]==1){
                            $tennis_throw[3][1]++;
                        }else{
                            $tennis_throw[3][2]++;
                        }
                        if($report_result["age"]>=3 && $report_result["age"]<4){
                            $tennis_throw[3][3]++;
                        }else if($report_result["age"]>=4 && $report_result["age"]<5){
                            $tennis_throw[3][4]++;
                        }else if($report_result["age"]>=5){
                            $tennis_throw[3][5]++;
                        }else{
                            $tennis_throw[3][6]++;
                        }
                    }
                    if($report_result["tennis_throw"]==5){
                        $tennis_throw[4][0]++;
                        if($value["gender"]==1){
                            $tennis_throw[4][1]++;
                        }else{
                            $tennis_throw[4][2]++;
                        }
                        if($report_result["age"]>=3 && $report_result["age"]<4){
                            $tennis_throw[4][3]++;
                        }else if($report_result["age"]>=4 && $report_result["age"]<5){
                            $tennis_throw[4][4]++;
                        }else if($report_result["age"]>=5){
                            $tennis_throw[4][5]++;
                        }else{
                            $tennis_throw[4][6]++;
                        }
                    }
                    if($report_result["balanceBeam"]==1){
                        $balanceBeam[0][0]++;
                        if($value["gender"]==1){
                            $balanceBeam[0][1]++;
                        }else{
                            $balanceBeam[0][2]++;
                        }
                        if($report_result["age"]>=3 && $report_result["age"]<4){
                            $balanceBeam[0][3]++;
                        }else if($report_result["age"]>=4 && $report_result["age"]<5){
                            $balanceBeam[0][4]++;
                        }else if($report_result["age"]>=5){
                            $balanceBeam[0][5]++;
                        }else{
                            $balanceBeam[0][6]++;
                        }
                    }
                    if($report_result["balanceBeam"]==2){
                        $balanceBeam[1][0]++;
                        if($value["gender"]==1){
                            $balanceBeam[1][1]++;
                        }else{
                            $balanceBeam[1][2]++;
                        }
                        if($report_result["age"]>=3 && $report_result["age"]<4){
                            $balanceBeam[1][3]++;
                        }else if($report_result["age"]>=4 && $report_result["age"]<5){
                            $balanceBeam[1][4]++;
                        }else if($report_result["age"]>=5){
                            $balanceBeam[1][5]++;
                        }else{
                            $balanceBeam[1][6]++;
                        }
                    }
                    if($report_result["balanceBeam"]==3){
                        $balanceBeam[2][0]++;
                        if($value["gender"]==1){
                            $balanceBeam[2][1]++;
                        }else{
                            $balanceBeam[2][2]++;
                        }
                        if($report_result["age"]>=3 && $report_result["age"]<4){
                            $balanceBeam[2][3]++;
                        }else if($report_result["age"]>=4 && $report_result["age"]<5){
                            $balanceBeam[2][4]++;
                        }else if($report_result["age"]>=5){
                            $balanceBeam[2][5]++;
                        }else{
                            $balanceBeam[2][6]++;
                        }
                    }
                    if($report_result["balanceBeam"]==4){
                        $balanceBeam[3][0]++;
                        if($value["gender"]==1){
                            $balanceBeam[3][1]++;
                        }else{
                            $balanceBeam[3][2]++;
                        }
                        if($report_result["age"]>=3 && $report_result["age"]<4){
                            $balanceBeam[3][3]++;
                        }else if($report_result["age"]>=4 && $report_result["age"]<5){
                            $balanceBeam[3][4]++;
                        }else if($report_result["age"]>=5){
                            $balanceBeam[3][5]++;
                        }else{
                            $balanceBeam[3][6]++;
                        }
                    }
                    if($report_result["balanceBeam"]==5){
                        $balanceBeam[4][0]++;
                        if($value["gender"]==1){
                            $balanceBeam[4][1]++;
                        }else{
                            $balanceBeam[4][2]++;
                        }
                        if($report_result["age"]>=3 && $report_result["age"]<4){
                            $balanceBeam[4][3]++;
                        }else if($report_result["age"]>=4 && $report_result["age"]<5){
                            $balanceBeam[4][4]++;
                        }else if($report_result["age"]>=5){
                            $balanceBeam[4][5]++;
                        }else{
                            $balanceBeam[4][6]++;
                        }
                    }
                    if($report_result["continuousJump"]==1){
                        $continuousJump[0][0]++;
                        if($value["gender"]==1){
                            $continuousJump[0][1]++;
                        }else{
                            $continuousJump[0][2]++;
                        }
                        if($report_result["age"]>=3 && $report_result["age"]<4){
                            $continuousJump[0][3]++;
                        }else if($report_result["age"]>=4 && $report_result["age"]<5){
                            $continuousJump[0][4]++;
                        }else if($report_result["age"]>=5){
                            $continuousJump[0][5]++;
                        }else{
                            $continuousJump[0][6]++;
                        }
                    }
                    if($report_result["continuousJump"]==2){
                        $continuousJump[1][0]++;
                        if($value["gender"]==1){
                            $continuousJump[1][1]++;
                        }else{
                            $continuousJump[1][2]++;
                        }
                        if($report_result["age"]>=3 && $report_result["age"]<4){
                            $continuousJump[1][3]++;
                        }else if($report_result["age"]>=4 && $report_result["age"]<5){
                            $continuousJump[1][4]++;
                        }else if($report_result["age"]>=5){
                            $continuousJump[1][5]++;
                        }else{
                            $continuousJump[1][6]++;
                        }
                    }
                    if($report_result["continuousJump"]==3){
                        $continuousJump[2][0]++;
                        if($value["gender"]==1){
                            $continuousJump[2][1]++;
                        }else{
                            $continuousJump[2][2]++;
                        }
                        if($report_result["age"]>=3 && $report_result["age"]<4){
                            $continuousJump[2][3]++;
                        }else if($report_result["age"]>=4 && $report_result["age"]<5){
                            $continuousJump[2][4]++;
                        }else if($report_result["age"]>=5){
                            $continuousJump[2][5]++;
                        }else{
                            $continuousJump[2][6]++;
                        }
                    }
                    if($report_result["continuousJump"]==4){
                        $continuousJump[3][0]++;
                        if($value["gender"]==1){
                            $continuousJump[3][1]++;
                        }else{
                            $continuousJump[3][2]++;
                        }
                        if($report_result["age"]>=3 && $report_result["age"]<4){
                            $continuousJump[3][3]++;
                        }else if($report_result["age"]>=4 && $report_result["age"]<5){
                            $continuousJump[3][4]++;
                        }else if($report_result["age"]>=5){
                            $continuousJump[3][5]++;
                        }else{
                            $continuousJump[3][6]++;
                        }
                    }
                    if($report_result["continuousJump"]==5){
                        $continuousJump[4][0]++;
                        if($value["gender"]==1){
                            $continuousJump[4][1]++;
                        }else{
                            $continuousJump[4][2]++;
                        }
                        if($report_result["age"]>=3 && $report_result["age"]<4){
                            $continuousJump[4][3]++;
                        }else if($report_result["age"]>=4 && $report_result["age"]<5){
                            $continuousJump[4][4]++;
                        }else if($report_result["age"]>=5){
                            $continuousJump[4][5]++;
                        }else{
                            $continuousJump[4][6]++;
                        }
                    }
                        if($report_result["is_obesity"]==1){
                            $weight[0][0]++;
                            if($value["gender"]==1){
                                $weight[0][1]++;
                            }else{
                                $weight[0][2]++;
                            }
                            if($report_result["age"]>=3 && $report_result["age"]<4){
                                $weight[0][3]++;
                            }else if($report_result["age"]>=4 && $report_result["age"]<5){
                                $weight[0][4]++;
                            }else if($report_result["age"]>=5){
                                $weight[0][5]++;
                            }else{
                                $weight[0][6]++;
                            }
                        }
                        if($report_result["is_obesity"]==2){
                            $weight[1][0]++;
                            if($value["gender"]==1){
                                $weight[1][1]++;
                            }else{
                                $weight[1][2]++;
                            }
                            if($report_result["age"]>=3 && $report_result["age"]<4){
                                $weight[1][3]++;
                            }else if($report_result["age"]>=4 && $report_result["age"]<5){
                                $weight[1][4]++;
                            }else if($report_result["age"]>=5){
                                $weight[1][5]++;
                            }else{
                                $weight[1][6]++;
                            }
                        }
                        if($report_result["is_obesity"]==3){
                            $weight[2][0]++;
                            if($value["gender"]==1){
                                $weight[2][1]++;
                            }else{
                                $weight[2][2]++;
                            }
                            if($report_result["age"]>=3 && $report_result["age"]<4){
                                $weight[2][3]++;
                            }else if($report_result["age"]>=4 && $report_result["age"]<5){
                                $weight[2][4]++;
                            }else if($report_result["age"]>=5){
                                $weight[2][5]++;
                            }else{
                                $weight[2][6]++;
                            }
                        }
                        if($report_result["is_obesity"]==4){
                            $weight[3][0]++;
                            if($value["gender"]==1){
                                $weight[3][1]++;
                            }else{
                                $weight[3][2]++;
                            }
                            if($report_result["age"]>=3 && $report_result["age"]<4){
                                $weight[3][3]++;
                            }else if($report_result["age"]>=4 && $report_result["age"]<5){
                                $weight[3][4]++;
                            }else if($report_result["age"]>=5){
                                $weight[3][5]++;
                            }else{
                                $weight[3][6]++;
                            }
                        }
                        if($report_result["is_obesity"]==5){
                            $weight[4][0]++;
                            if($value["gender"]==1){
                                $weight[4][1]++;
                            }else{
                                $weight[4][2]++;
                            }
                            if($report_result["age"]>=3 && $report_result["age"]<4){
                                $weight[4][3]++;
                            }else if($report_result["age"]>=4 && $report_result["age"]<5){
                                $weight[4][4]++;
                            }else if($report_result["age"]>=5){
                                $weight[4][5]++;
                            }else{
                                $weight[4][6]++;
                            }
                        }
                        if($report_result["height"]==5){
                            $height[0][0]++;
                            if($value["gender"]==1){
                                $height[0][1]++;
                            }else{
                                $height[0][2]++;
                            }
                            if($report_result["age"]>=3 && $report_result["age"]<4){
                                $height[0][3]++;
                            }else if($report_result["age"]>=4 && $report_result["age"]<5){
                                $height[0][4]++;
                            }else if($report_result["age"]>=5){
                                $height[0][5]++;
                            }else{
                                $height[0][6]++;
                            }
                        }
                        if($report_result["height"]==4){
                            $height[1][0]++;
                            if($value["gender"]==1){
                                $height[1][1]++;
                            }else{
                                $height[1][2]++;
                            }
                            if($report_result["age"]>=3 && $report_result["age"]<4){
                                $height[1][3]++;
                            }else if($report_result["age"]>=4 && $report_result["age"]<5){
                                $height[1][4]++;
                            }else if($report_result["age"]>=5){
                                $height[1][5]++;
                            }else{
                                $height[1][6]++;
                            }
                        }
                        if($report_result["height"]==3){
                            $height[2][0]++;
                            if($value["gender"]==1){
                                $height[2][1]++;
                            }else{
                                $height[2][2]++;
                            }
                            if($report_result["age"]>=3 && $report_result["age"]<4){
                                $height[2][3]++;
                            }else if($report_result["age"]>=4 && $report_result["age"]<5){
                                $height[2][4]++;
                            }else if($report_result["age"]>=5){
                                $height[2][5]++;
                            }else{
                                $height[2][6]++;
                            }
                        }
                        if($report_result["height"]==2){
                            $height[3][0]++;
                            if($value["gender"]==1){
                                $height[3][1]++;
                            }else{
                                $height[3][2]++;
                            }
                            if($report_result["age"]>=3 && $report_result["age"]<4){
                                $height[3][3]++;
                            }else if($report_result["age"]>=4 && $report_result["age"]<5){
                                $height[3][4]++;
                            }else if($report_result["age"]>=5){
                                $height[3][5]++;
                            }else{
                                $height[3][6]++;
                            }
                        }
                        if($report_result["height"]==1){
                            $height[4][0]++;
                            if($value["gender"]==1){
                                $height[4][1]++;
                            }else{
                                $height[4][2]++;
                            }
                            if($report_result["age"]>=3 && $report_result["age"]<4){
                                $height[4][3]++;
                            }else if($report_result["age"]>=4 && $report_result["age"]<5){
                                $height[4][4]++;
                            }else if($report_result["age"]>=5){
                                $height[4][5]++;
                            }else{
                                $height[4][6]++;
                            }
                        }
                        if($report_result["result"]==1){
                            $physicallevel[0][0]++;
                            if($value["gender"]==1){
                                $physicallevel[0][1]++;
                            }else{
                                $physicallevel[0][2]++;
                            }
                            if($report_result["age"]>=3 && $report_result["age"]<4){
                                $age[0][0]++;
                            }else if($report_result["age"]>=4 && $report_result["age"]<5){
                                $age[0][1]++;
                            }else if($report_result["age"]>=5){
                                $age[0][2]++;
                            }else{
                                $age[0][3]++;
                            }
                        }
                        if($report_result["result"]==2){
                            $physicallevel[1][0]++;
                            if($value["gender"]==1){
                                $physicallevel[1][1]++;
                            }else{
                                $physicallevel[1][2]++;
                            }
                            if($report_result["age"]>=3 && $report_result["age"]<4){
                                $age[1][0]++;
                            }else if($report_result["age"]>=4 && $report_result["age"]<5){
                                $age[1][1]++;
                            }else if($report_result["age"]>=5){
                                $age[1][2]++;
                            }else{
                                $age[1][3]++;
                            }
                        }
                        if($report_result["result"]==3){
                            $physicallevel[2][0]++;
                            if($value["gender"]==1){
                                $physicallevel[2][1]++;
                            }else{
                                $physicallevel[2][2]++;
                            }
                            if($report_result["age"]>=3 && $report_result["age"]<4){
                                $age[2][0]++;
                            }else if($report_result["age"]>=4 && $report_result["age"]<5){
                                $age[2][1]++;
                            }else if($report_result["age"]>=5){
                                $age[2][2]++;
                            }else{
                                $age[2][3]++;
                            }
                        }
                        if($report_result["result"]==4){
                            $physicallevel[3][0]++;
                            if($value["gender"]==1){
                                $physicallevel[3][1]++;
                            }else{
                                $physicallevel[3][2]++;
                            }
                            if($report_result["age"]>=3 && $report_result["age"]<4){
                                $age[3][0]++;
                            }else if($report_result["age"]>=4 && $report_result["age"]<5){
                                $age[3][1]++;
                            }else if($report_result["age"]>=5){
                                $age[3][2]++;
                            }else{
                                $age[3][3]++;
                            }
                        }
                    }
                }else{
                	$effective_number++;
                	// 判断开始
                	$height_sum++;
                	$weight_sum++;
                	if($value["heart_rate"]<80){
                		$heartrate[0][0]++;
                		if($value["gender"]==1){
                			$heartrate[0][1]++;
                		}else{
                			$heartrate[0][2]++;
                		}
                		if($report_result["age"]>=3 && $report_result["age"]<4){
                    		$heartrate[0][3]++;
                    	}else if($report_result["age"]>=4 && $report_result["age"]<5){
                    		$heartrate[0][4]++;
                    	}else if($report_result["age"]>=5){
                    		$heartrate[0][5]++;
                    	}else{
                    		$heartrate[0][6]++;
                    	}
                	}
                	if($value["heart_rate"]>=80 && $value["heart_rate"]<=120){
    	                $heartrate[1][0]++;
                		if($value["gender"]==1){
                			$heartrate[1][1]++;
                		}else{
                			$heartrate[1][2]++;
                		}
                		if($report_result["age"]>=3 && $report_result["age"]<4){
                    		$heartrate[1][3]++;
                    	}else if($report_result["age"]>=4 && $report_result["age"]<5){
                    		$heartrate[1][4]++;
                    	}else if($report_result["age"]>=5){
                    		$heartrate[1][5]++;
                    	}else{
                    		$heartrate[1][6]++;
                    	}
    	            }
    	            if($value["heart_rate"]>120){
    	            	$heartrate[2][0]++;
    	                if($value["gender"]==1){
                			$heartrate[2][1]++;
                		}else{
                			$heartrate[2][2]++;
                		}
                		if($report_result["age"]>=3 && $report_result["age"]<4){
                    		$heartrate[2][3]++;
                    	}else if($report_result["age"]>=4 && $report_result["age"]<5){
                    		$heartrate[2][4]++;
                    	}else if($report_result["age"]>=5){
                    		$heartrate[2][5]++;
                    	}else{
                    		$heartrate[2][6]++;
                    	}
    	            }
    	            if($report_result["standing_long_jump"]==1){
                		$standing_long_jump[0][0]++;
                		if($value["gender"]==1){
                			$standing_long_jump[0][1]++;
                		}else{
                			$standing_long_jump[0][2]++;
                		}
                		if($report_result["age"]>=3 && $report_result["age"]<4){
                    		$standing_long_jump[0][3]++;
                    	}else if($report_result["age"]>=4 && $report_result["age"]<5){
                    		$standing_long_jump[0][4]++;
                    	}else if($report_result["age"]>=5){
                    		$standing_long_jump[0][5]++;
                    	}else{
                    		$standing_long_jump[0][6]++;
                    	}
                	}
                	if($report_result["standing_long_jump"]==2){
                		$standing_long_jump[1][0]++;
                		if($value["gender"]==1){
                			$standing_long_jump[1][1]++;
                		}else{
                			$standing_long_jump[1][2]++;
                		}
                		if($report_result["age"]>=3 && $report_result["age"]<4){
                    		$standing_long_jump[1][3]++;
                    	}else if($report_result["age"]>=4 && $report_result["age"]<5){
                    		$standing_long_jump[1][4]++;
                    	}else if($report_result["age"]>=5){
                    		$standing_long_jump[1][5]++;
                    	}else{
                    		$standing_long_jump[1][6]++;
                    	}
                	}
                	if($report_result["standing_long_jump"]==3){
                		$standing_long_jump[2][0]++;
                		if($value["gender"]==1){
                			$standing_long_jump[2][1]++;
                		}else{
                			$standing_long_jump[2][2]++;
                		}
                		if($report_result["age"]>=3 && $report_result["age"]<4){
                    		$standing_long_jump[2][3]++;
                    	}else if($report_result["age"]>=4 && $report_result["age"]<5){
                    		$standing_long_jump[2][4]++;
                    	}else if($report_result["age"]>=5){
                    		$standing_long_jump[2][5]++;
                    	}else{
                    		$standing_long_jump[2][6]++;
                    	}
                	}
                	if($report_result["standing_long_jump"]==4){
                		$standing_long_jump[3][0]++;
                		if($value["gender"]==1){
                			$standing_long_jump[3][1]++;
                		}else{
                			$standing_long_jump[3][2]++;
                		}
                		if($report_result["age"]>=3 && $report_result["age"]<4){
                    		$standing_long_jump[3][3]++;
                    	}else if($report_result["age"]>=4 && $report_result["age"]<5){
                    		$standing_long_jump[3][4]++;
                    	}else if($report_result["age"]>=5){
                    		$standing_long_jump[3][5]++;
                    	}else{
                    		$standing_long_jump[3][6]++;
                    	}
                	}
                	if($report_result["standing_long_jump"]==5){
                		$standing_long_jump[4][0]++;
                		if($value["gender"]==1){
                			$standing_long_jump[4][1]++;
                		}else{
                			$standing_long_jump[4][2]++;
                		}
                		if($report_result["age"]>=3 && $report_result["age"]<4){
                    		$standing_long_jump[4][3]++;
                    	}else if($report_result["age"]>=4 && $report_result["age"]<5){
                    		$standing_long_jump[4][4]++;
                    	}else if($report_result["age"]>=5){
                    		$standing_long_jump[4][5]++;
                    	}else{
                    		$standing_long_jump[4][6]++;
                    	}
                	}
                	if($report_result["reentry_run"]==1){
                		$reentry_run[0][0]++;
                		if($value["gender"]==1){
                			$reentry_run[0][1]++;
                		}else{
                			$reentry_run[0][2]++;
                		}
                		if($report_result["age"]>=3 && $report_result["age"]<4){
                    		$reentry_run[0][3]++;
                    	}else if($report_result["age"]>=4 && $report_result["age"]<5){
                    		$reentry_run[0][4]++;
                    	}else if($report_result["age"]>=5){
                    		$reentry_run[0][5]++;
                    	}else{
                    		$reentry_run[0][6]++;
                    	}
                	}
                	if($report_result["reentry_run"]==2){
                		$reentry_run[1][0]++;
                		if($value["gender"]==1){
                			$reentry_run[1][1]++;
                		}else{
                			$reentry_run[1][2]++;
                		}
                		if($report_result["age"]>=3 && $report_result["age"]<4){
                    		$reentry_run[1][3]++;
                    	}else if($report_result["age"]>=4 && $report_result["age"]<5){
                    		$reentry_run[1][4]++;
                    	}else if($report_result["age"]>=5){
                    		$reentry_run[1][5]++;
                    	}else{
                    		$reentry_run[1][6]++;
                    	}
                	}
                	if($report_result["reentry_run"]==3){
                		$reentry_run[2][0]++;
                		if($value["gender"]==1){
                			$reentry_run[2][1]++;
                		}else{
                			$reentry_run[2][2]++;
                		}
                		if($report_result["age"]>=3 && $report_result["age"]<4){
                    		$reentry_run[2][3]++;
                    	}else if($report_result["age"]>=4 && $report_result["age"]<5){
                    		$reentry_run[2][4]++;
                    	}else if($report_result["age"]>=5){
                    		$reentry_run[2][5]++;
                    	}else{
                    		$reentry_run[2][6]++;
                    	}
                	}
                	if($report_result["reentry_run"]==4){
                		$reentry_run[3][0]++;
                		if($value["gender"]==1){
                			$reentry_run[3][1]++;
                		}else{
                			$reentry_run[3][2]++;
                		}
                		if($report_result["age"]>=3 && $report_result["age"]<4){
                    		$reentry_run[3][3]++;
                    	}else if($report_result["age"]>=4 && $report_result["age"]<5){
                    		$reentry_run[3][4]++;
                    	}else if($report_result["age"]>=5){
                    		$reentry_run[3][5]++;
                    	}else{
                    		$reentry_run[3][6]++;
                    	}
                	}
                	if($report_result["reentry_run"]==5){
                		$reentry_run[4][0]++;
                		if($value["gender"]==1){
                			$reentry_run[4][1]++;
                		}else{
                			$reentry_run[4][2]++;
                		}
                		if($report_result["age"]>=3 && $report_result["age"]<4){
                    		$reentry_run[4][3]++;
                    	}else if($report_result["age"]>=4 && $report_result["age"]<5){
                    		$reentry_run[4][4]++;
                    	}else if($report_result["age"]>=5){
                    		$reentry_run[4][5]++;
                    	}else{
                    		$reentry_run[4][6]++;
                    	}
                	}
            	if($report_result["flexion"]==1){
            		$flexion[0][0]++;
            		if($value["gender"]==1){
            			$flexion[0][1]++;
            		}else{
            			$flexion[0][2]++;
            		}
            		if($report_result["age"]>=3 && $report_result["age"]<4){
                		$flexion[0][3]++;
                	}else if($report_result["age"]>=4 && $report_result["age"]<5){
                		$flexion[0][4]++;
                	}else if($report_result["age"]>=5){
                		$flexion[0][5]++;
                	}else{
                		$flexion[0][6]++;
                	}
            	}
            	if($report_result["flexion"]==2){
            		$flexion[1][0]++;
            		if($value["gender"]==1){
            			$flexion[1][1]++;
            		}else{
            			$flexion[1][2]++;
            		}
            		if($report_result["age"]>=3 && $report_result["age"]<4){
                		$flexion[1][3]++;
                	}else if($report_result["age"]>=4 && $report_result["age"]<5){
                		$flexion[1][4]++;
                	}else if($report_result["age"]>=5){
                		$flexion[1][5]++;
                	}else{
                		$flexion[1][6]++;
                	}
            	}
            	if($report_result["flexion"]==3){
            		$flexion[2][0]++;
            		if($value["gender"]==1){
            			$flexion[2][1]++;
            		}else{
            			$flexion[2][2]++;
            		}
            		if($report_result["age"]>=3 && $report_result["age"]<4){
                		$flexion[2][3]++;
                	}else if($report_result["age"]>=4 && $report_result["age"]<5){
                		$flexion[2][4]++;
                	}else if($report_result["age"]>=5){
                		$flexion[2][5]++;
                	}else{
                		$flexion[2][6]++;
                	}
            	}
            	if($report_result["flexion"]==4){
            		$flexion[3][0]++;
            		if($value["gender"]==1){
            			$flexion[3][1]++;
            		}else{
            			$flexion[3][2]++;
            		}
            		if($report_result["age"]>=3 && $report_result["age"]<4){
                		$flexion[3][3]++;
                	}else if($report_result["age"]>=4 && $report_result["age"]<5){
                		$flexion[3][4]++;
                	}else if($report_result["age"]>=5){
                		$flexion[3][5]++;
                	}else{
                		$flexion[3][6]++;
                	}
            	}
            	if($report_result["flexion"]==5){
            		$flexion[4][0]++;
            		if($value["gender"]==1){
            			$flexion[4][1]++;
            		}else{
            			$flexion[4][2]++;
            		}
            		if($report_result["age"]>=3 && $report_result["age"]<4){
                		$flexion[4][3]++;
                	}else if($report_result["age"]>=4 && $report_result["age"]<5){
                		$flexion[4][4]++;
                	}else if($report_result["age"]>=5){
                		$flexion[4][5]++;
                	}else{
                		$flexion[4][6]++;
                	}
            	}
            	if($report_result["tennis_throw"]==1){
            		$tennis_throw[0][0]++;
            		if($value["gender"]==1){
            			$tennis_throw[0][1]++;
            		}else{
            			$tennis_throw[0][2]++;
            		}
            		if($report_result["age"]>=3 && $report_result["age"]<4){
                		$tennis_throw[0][3]++;
                	}else if($report_result["age"]>=4 && $report_result["age"]<5){
                		$tennis_throw[0][4]++;
                	}else if($report_result["age"]>=5){
                		$tennis_throw[0][5]++;
                	}else{
                		$tennis_throw[0][6]++;
                	}
            	}
            	if($report_result["tennis_throw"]==2){
            		$tennis_throw[1][0]++;
            		if($value["gender"]==1){
            			$tennis_throw[1][1]++;
            		}else{
            			$tennis_throw[1][2]++;
            		}
            		if($report_result["age"]>=3 && $report_result["age"]<4){
                		$tennis_throw[1][3]++;
                	}else if($report_result["age"]>=4 && $report_result["age"]<5){
                		$tennis_throw[1][4]++;
                	}else if($report_result["age"]>=5){
                		$tennis_throw[1][5]++;
                	}else{
                		$tennis_throw[1][6]++;
                	}
            	}
            	if($report_result["tennis_throw"]==3){
            		$tennis_throw[2][0]++;
            		if($value["gender"]==1){
            			$tennis_throw[2][1]++;
            		}else{
            			$tennis_throw[2][2]++;
            		}
            		if($report_result["age"]>=3 && $report_result["age"]<4){
                		$tennis_throw[2][3]++;
                	}else if($report_result["age"]>=4 && $report_result["age"]<5){
                		$tennis_throw[2][4]++;
                	}else if($report_result["age"]>=5){
                		$tennis_throw[2][5]++;
                	}else{
                		$tennis_throw[2][6]++;
                	}
            	}
            	if($report_result["tennis_throw"]==4){
            		$tennis_throw[3][0]++;
            		if($value["gender"]==1){
            			$tennis_throw[3][1]++;
            		}else{
            			$tennis_throw[3][2]++;
            		}
            		if($report_result["age"]>=3 && $report_result["age"]<4){
                		$tennis_throw[3][3]++;
                	}else if($report_result["age"]>=4 && $report_result["age"]<5){
                		$tennis_throw[3][4]++;
                	}else if($report_result["age"]>=5){
                		$tennis_throw[3][5]++;
                	}else{
                		$tennis_throw[3][6]++;
                	}
            	}
            	if($report_result["tennis_throw"]==5){
            		$tennis_throw[4][0]++;
            		if($value["gender"]==1){
            			$tennis_throw[4][1]++;
            		}else{
            			$tennis_throw[4][2]++;
            		}
            		if($report_result["age"]>=3 && $report_result["age"]<4){
                		$tennis_throw[4][3]++;
                	}else if($report_result["age"]>=4 && $report_result["age"]<5){
                		$tennis_throw[4][4]++;
                	}else if($report_result["age"]>=5){
                		$tennis_throw[4][5]++;
                	}else{
                		$tennis_throw[4][6]++;
                	}
            	}
            	if($report_result["balanceBeam"]==1){
            		$balanceBeam[0][0]++;
            		if($value["gender"]==1){
            			$balanceBeam[0][1]++;
            		}else{
            			$balanceBeam[0][2]++;
            		}
            		if($report_result["age"]>=3 && $report_result["age"]<4){
                		$balanceBeam[0][3]++;
                	}else if($report_result["age"]>=4 && $report_result["age"]<5){
                		$balanceBeam[0][4]++;
                	}else if($report_result["age"]>=5){
                		$balanceBeam[0][5]++;
                	}else{
                		$balanceBeam[0][6]++;
                	}
            	}
            	if($report_result["balanceBeam"]==2){
            		$balanceBeam[1][0]++;
            		if($value["gender"]==1){
            			$balanceBeam[1][1]++;
            		}else{
            			$balanceBeam[1][2]++;
            		}
            		if($report_result["age"]>=3 && $report_result["age"]<4){
                		$balanceBeam[1][3]++;
                	}else if($report_result["age"]>=4 && $report_result["age"]<5){
                		$balanceBeam[1][4]++;
                	}else if($report_result["age"]>=5){
                		$balanceBeam[1][5]++;
                	}else{
                		$balanceBeam[1][6]++;
                	}
            	}
            	if($report_result["balanceBeam"]==3){
            		$balanceBeam[2][0]++;
            		if($value["gender"]==1){
            			$balanceBeam[2][1]++;
            		}else{
            			$balanceBeam[2][2]++;
            		}
            		if($report_result["age"]>=3 && $report_result["age"]<4){
                		$balanceBeam[2][3]++;
                	}else if($report_result["age"]>=4 && $report_result["age"]<5){
                		$balanceBeam[2][4]++;
                	}else if($report_result["age"]>=5){
                		$balanceBeam[2][5]++;
                	}else{
                		$balanceBeam[2][6]++;
                	}
            	}
            	if($report_result["balanceBeam"]==4){
            		$balanceBeam[3][0]++;
            		if($value["gender"]==1){
            			$balanceBeam[3][1]++;
            		}else{
            			$balanceBeam[3][2]++;
            		}
            		if($report_result["age"]>=3 && $report_result["age"]<4){
                		$balanceBeam[3][3]++;
                	}else if($report_result["age"]>=4 && $report_result["age"]<5){
                		$balanceBeam[3][4]++;
                	}else if($report_result["age"]>=5){
                		$balanceBeam[3][5]++;
                	}else{
                		$balanceBeam[3][6]++;
                	}
            	}
            	if($report_result["balanceBeam"]==5){
            		$balanceBeam[4][0]++;
            		if($value["gender"]==1){
            			$balanceBeam[4][1]++;
            		}else{
            			$balanceBeam[4][2]++;
            		}
            		if($report_result["age"]>=3 && $report_result["age"]<4){
                		$balanceBeam[4][3]++;
                	}else if($report_result["age"]>=4 && $report_result["age"]<5){
                		$balanceBeam[4][4]++;
                	}else if($report_result["age"]>=5){
                		$balanceBeam[4][5]++;
                	}else{
                		$balanceBeam[4][6]++;
                	}
            	}
            	if($report_result["continuousJump"]==1){
            		$continuousJump[0][0]++;
            		if($value["gender"]==1){
            			$continuousJump[0][1]++;
            		}else{
            			$continuousJump[0][2]++;
            		}
            		if($report_result["age"]>=3 && $report_result["age"]<4){
                		$continuousJump[0][3]++;
                	}else if($report_result["age"]>=4 && $report_result["age"]<5){
                		$continuousJump[0][4]++;
                	}else if($report_result["age"]>=5){
                		$continuousJump[0][5]++;
                	}else{
                		$continuousJump[0][6]++;
                	}
            	}
            	if($report_result["continuousJump"]==2){
            		$continuousJump[1][0]++;
            		if($value["gender"]==1){
            			$continuousJump[1][1]++;
            		}else{
            			$continuousJump[1][2]++;
            		}
            		if($report_result["age"]>=3 && $report_result["age"]<4){
                		$continuousJump[1][3]++;
                	}else if($report_result["age"]>=4 && $report_result["age"]<5){
                		$continuousJump[1][4]++;
                	}else if($report_result["age"]>=5){
                		$continuousJump[1][5]++;
                	}else{
                		$continuousJump[1][6]++;
                	}
            	}
            	if($report_result["continuousJump"]==3){
            		$continuousJump[2][0]++;
            		if($value["gender"]==1){
            			$continuousJump[2][1]++;
            		}else{
            			$continuousJump[2][2]++;
            		}
            		if($report_result["age"]>=3 && $report_result["age"]<4){
                		$continuousJump[2][3]++;
                	}else if($report_result["age"]>=4 && $report_result["age"]<5){
                		$continuousJump[2][4]++;
                	}else if($report_result["age"]>=5){
                		$continuousJump[2][5]++;
                	}else{
                		$continuousJump[2][6]++;
                	}
            	}
            	if($report_result["continuousJump"]==4){
            		$continuousJump[3][0]++;
            		if($value["gender"]==1){
            			$continuousJump[3][1]++;
            		}else{
            			$continuousJump[3][2]++;
            		}
            		if($report_result["age"]>=3 && $report_result["age"]<4){
                		$continuousJump[3][3]++;
                	}else if($report_result["age"]>=4 && $report_result["age"]<5){
                		$continuousJump[3][4]++;
                	}else if($report_result["age"]>=5){
                		$continuousJump[3][5]++;
                	}else{
                		$continuousJump[3][6]++;
                	}
            	}
            	if($report_result["continuousJump"]==5){
            		$continuousJump[4][0]++;
            		if($value["gender"]==1){
            			$continuousJump[4][1]++;
            		}else{
            			$continuousJump[4][2]++;
            		}
            		if($report_result["age"]>=3 && $report_result["age"]<4){
                		$continuousJump[4][3]++;
                	}else if($report_result["age"]>=4 && $report_result["age"]<5){
                		$continuousJump[4][4]++;
                	}else if($report_result["age"]>=5){
                		$continuousJump[4][5]++;
                	}else{
                		$continuousJump[4][6]++;
                	}
            	}
                	if($report_result["is_obesity"]==1){
                		$weight[0][0]++;
                		if($value["gender"]==1){
                			$weight[0][1]++;
                		}else{
                			$weight[0][2]++;
                		}
                		if($report_result["age"]>=3 && $report_result["age"]<4){
                    		$weight[0][3]++;
                    	}else if($report_result["age"]>=4 && $report_result["age"]<5){
                    		$weight[0][4]++;
                    	}else if($report_result["age"]>=5){
                    		$weight[0][5]++;
                    	}else{
                    		$weight[0][6]++;
                    	}
                	}
                	if($report_result["is_obesity"]==2){
                		$weight[1][0]++;
                		if($value["gender"]==1){
                			$weight[1][1]++;
                		}else{
                			$weight[1][2]++;
                		}
                		if($report_result["age"]>=3 && $report_result["age"]<4){
                    		$weight[1][3]++;
                    	}else if($report_result["age"]>=4 && $report_result["age"]<5){
                    		$weight[1][4]++;
                    	}else if($report_result["age"]>=5){
                    		$weight[1][5]++;
                    	}else{
                    		$weight[1][6]++;
                    	}
                	}
                	if($report_result["is_obesity"]==3){
                		$weight[2][0]++;
                		if($value["gender"]==1){
                			$weight[2][1]++;
                		}else{
                			$weight[2][2]++;
                		}
                		if($report_result["age"]>=3 && $report_result["age"]<4){
                    		$weight[2][3]++;
                    	}else if($report_result["age"]>=4 && $report_result["age"]<5){
                    		$weight[2][4]++;
                    	}else if($report_result["age"]>=5){
                    		$weight[2][5]++;
                    	}else{
                    		$weight[2][6]++;
                    	}
                	}
                	if($report_result["is_obesity"]==4){
                		$weight[3][0]++;
                		if($value["gender"]==1){
                			$weight[3][1]++;
                		}else{
                			$weight[3][2]++;
                		}
                		if($report_result["age"]>=3 && $report_result["age"]<4){
                    		$weight[3][3]++;
                    	}else if($report_result["age"]>=4 && $report_result["age"]<5){
                    		$weight[3][4]++;
                    	}else if($report_result["age"]>=5){
                    		$weight[3][5]++;
                    	}else{
                    		$weight[3][6]++;
                    	}
                	}
                	if($report_result["is_obesity"]==5){
                		$weight[4][0]++;
                		if($value["gender"]==1){
                			$weight[4][1]++;
                		}else{
                			$weight[4][2]++;
                		}
                		if($report_result["age"]>=3 && $report_result["age"]<4){
                    		$weight[4][3]++;
                    	}else if($report_result["age"]>=4 && $report_result["age"]<5){
                    		$weight[4][4]++;
                    	}else if($report_result["age"]>=5){
                    		$weight[4][5]++;
                    	}else{
                    		$weight[4][6]++;
                    	}
                	}
                	if($report_result["height"]==5){
                		$height[0][0]++;
                		if($value["gender"]==1){
                			$height[0][1]++;
                		}else{
                			$height[0][2]++;
                		}
                		if($report_result["age"]>=3 && $report_result["age"]<4){
                    		$height[0][3]++;
                    	}else if($report_result["age"]>=4 && $report_result["age"]<5){
                    		$height[0][4]++;
                    	}else if($report_result["age"]>=5){
                    		$height[0][5]++;
                    	}else{
                    		$height[0][6]++;
                    	}
                	}
                	if($report_result["height"]==4){
                		$height[1][0]++;
                		if($value["gender"]==1){
                			$height[1][1]++;
                		}else{
                			$height[1][2]++;
                		}
                		if($report_result["age"]>=3 && $report_result["age"]<4){
                    		$height[1][3]++;
                    	}else if($report_result["age"]>=4 && $report_result["age"]<5){
                    		$height[1][4]++;
                    	}else if($report_result["age"]>=5){
                    		$height[1][5]++;
                    	}else{
                    		$height[1][6]++;
                    	}
                	}
                	if($report_result["height"]==3){
                		$height[2][0]++;
                		if($value["gender"]==1){
                			$height[2][1]++;
                		}else{
                			$height[2][2]++;
                		}
                		if($report_result["age"]>=3 && $report_result["age"]<4){
                    		$height[2][3]++;
                    	}else if($report_result["age"]>=4 && $report_result["age"]<5){
                    		$height[2][4]++;
                    	}else if($report_result["age"]>=5){
                    		$height[2][5]++;
                    	}else{
                    		$height[2][6]++;
                    	}
                	}
                	if($report_result["height"]==2){
                		$height[3][0]++;
                		if($value["gender"]==1){
                			$height[3][1]++;
                		}else{
                			$height[3][2]++;
                		}
                		if($report_result["age"]>=3 && $report_result["age"]<4){
                    		$height[3][3]++;
                    	}else if($report_result["age"]>=4 && $report_result["age"]<5){
                    		$height[3][4]++;
                    	}else if($report_result["age"]>=5){
                    		$height[3][5]++;
                    	}else{
                    		$height[3][6]++;
                    	}
                	}
                	if($report_result["height"]==1){
                		$height[4][0]++;
                		if($value["gender"]==1){
                			$height[4][1]++;
                		}else{
                			$height[4][2]++;
                		}
                		if($report_result["age"]>=3 && $report_result["age"]<4){
                    		$height[4][3]++;
                    	}else if($report_result["age"]>=4 && $report_result["age"]<5){
                    		$height[4][4]++;
                    	}else if($report_result["age"]>=5){
                    		$height[4][5]++;
                    	}else{
                    		$height[4][6]++;
                    	}
                	}
                	if($report_result["result"]==1){
                    	$physicallevel[0][0]++;
                    	if($value["gender"]==1){
                    		$physicallevel[0][1]++;
                    	}else{
                    		$physicallevel[0][2]++;
                    	}
                    	if($report_result["age"]>=3 && $report_result["age"]<4){
                    		$age[0][0]++;
                    	}else if($report_result["age"]>=4 && $report_result["age"]<5){
                    		$age[0][1]++;
                    	}else if($report_result["age"]>=5){
                    		$age[0][2]++;
                    	}else{
                    		$age[0][3]++;
                    	}
                    }
                    if($report_result["result"]==2){
                    	$physicallevel[1][0]++;
                    	if($value["gender"]==1){
                    		$physicallevel[1][1]++;
                    	}else{
                    		$physicallevel[1][2]++;
                    	}
                    	if($report_result["age"]>=3 && $report_result["age"]<4){
                    		$age[1][0]++;
                    	}else if($report_result["age"]>=4 && $report_result["age"]<5){
                    		$age[1][1]++;
                    	}else if($report_result["age"]>=5){
                    		$age[1][2]++;
                    	}else{
                    		$age[1][3]++;
                    	}
                    }
                    if($report_result["result"]==3){
                    	$physicallevel[2][0]++;
                    	if($value["gender"]==1){
                    		$physicallevel[2][1]++;
                    	}else{
                    		$physicallevel[2][2]++;
                    	}
                    	if($report_result["age"]>=3 && $report_result["age"]<4){
                    		$age[2][0]++;
                    	}else if($report_result["age"]>=4 && $report_result["age"]<5){
                    		$age[2][1]++;
                    	}else if($report_result["age"]>=5){
                    		$age[2][2]++;
                    	}else{
                    		$age[2][3]++;
                    	}
                    }
                    if($report_result["result"]==4){
                    	$physicallevel[3][0]++;
                    	if($value["gender"]==1){
                    		$physicallevel[3][1]++;
                    	}else{
                    		$physicallevel[3][2]++;
                    	}
                    	if($report_result["age"]>=3 && $report_result["age"]<4){
                    		$age[3][0]++;
                    	}else if($report_result["age"]>=4 && $report_result["age"]<5){
                    		$age[3][1]++;
                    	}else if($report_result["age"]>=5){
                    		$age[3][2]++;
                    	}else{
                    		$age[3][3]++;
                    	}
                    }
                }
                // 判断结束
            }else{
            	$invalid_number++;
            	$physicallevel[4][0]++;
            	$flexion[5]++;
            	$tennis_throw[5]++;
            	$standing_long_jump[5]++;
            	$reentry_run[5]++;
            	$balanceBeam[5]++;
            	$continuousJump[5]++;
            	$heartRate[3]++;
            	if($value["gender"]==1){
            		$physicallevel[4][1]++;
            	}else{
            		$physicallevel[4][2]++;
            	}
            	if($report_result["age"]>=3 && $report_result["age"]<4){
            		$age[4][0]++;
            	}else if($report_result["age"]>=4 && $report_result["age"]<5){
            		$age[4][1]++;
            	}else if($report_result["age"]>=5){
            		$age[4][2]++;
            	}else{
            		$age[4][3]++;
            	}
                if($report_result["height"]==5){
                    $height[5][0]++;
                    if($value["gender"]==1){
                        $height[5][1]++;
                    }else{
                        $height[5][2]++;
                    }
                    if($report_result["age"]>=3 && $report_result["age"]<4){
                        $height[5][3]++;
                    }else if($report_result["age"]>=4 && $report_result["age"]<5){
                        $height[5][4]++;
                    }else if($report_result["age"]>=5){
                        $height[5][5]++;
                    }else{
                        $height[5][6]++;
                    }
                }
                if($report_result["height"]==4){
                    $height[6][0]++;
                    if($value["gender"]==1){
                        $height[6][1]++;
                    }else{
                        $height[6][2]++;
                    }
                    if($report_result["age"]>=3 && $report_result["age"]<4){
                        $height[6][3]++;
                    }else if($report_result["age"]>=4 && $report_result["age"]<5){
                        $height[6][4]++;
                    }else if($report_result["age"]>=5){
                        $height[6][5]++;
                    }else{
                        $height[6][6]++;
                    }
                }
                if($report_result["height"]==3){
                    $height[7][0]++;
                    if($value["gender"]==1){
                        $height[7][1]++;
                    }else{
                        $height[7][2]++;
                    }
                    if($report_result["age"]>=3 && $report_result["age"]<4){
                        $height[7][3]++;
                    }else if($report_result["age"]>=4 && $report_result["age"]<5){
                        $height[7][4]++;
                    }else if($report_result["age"]>=5){
                        $height[7][5]++;
                    }else{
                        $height[7][6]++;
                    }
                }
                if($report_result["height"]==2){
                    $height[8][0]++;
                    if($value["gender"]==1){
                        $height[8][1]++;
                    }else{
                        $height[8][2]++;
                    }
                    if($report_result["age"]>=3 && $report_result["age"]<4){
                        $height[8][3]++;
                    }else if($report_result["age"]>=4 && $report_result["age"]<5){
                        $height[8][4]++;
                    }else if($report_result["age"]>=5){
                        $height[8][5]++;
                    }else{
                        $height[8][6]++;
                    }
                }
                if($report_result["height"]==1){
                    $height[9][0]++;
                    if($value["gender"]==1){
                        $height[9][1]++;
                    }else{
                        $height[9][2]++;
                    }
                    if($report_result["age"]>=3 && $report_result["age"]<4){
                        $height[9][3]++;
                    }else if($report_result["age"]>=4 && $report_result["age"]<5){
                        $height[9][4]++;
                    }else if($report_result["age"]>=5){
                        $height[9][5]++;
                    }else{
                        $height[9][6]++;
                    }
                }
                if($report_result["height"]==0){
                    $height[10][0]++;
                    if($value["gender"]==1){
                        $height[10][1]++;
                    }else{
                        $height[10][2]++;
                    }
                    if($report_result["age"]>=3 && $report_result["age"]<4){
                        $height[10][3]++;
                    }else if($report_result["age"]>=4 && $report_result["age"]<5){
                        $height[10][4]++;
                    }else if($report_result["age"]>=5){
                        $height[10][5]++;
                    }else{
                        $height[10][6]++;
                    }
                }
                if($report_result["is_obesity"]==1){
                    $weight[5][0]++;
                    if($value["gender"]==1){
                        $weight[5][1]++;
                    }else{
                        $weight[5][2]++;
                    }
                    if($report_result["age"]>=3 && $report_result["age"]<4){
                        $weight[5][3]++;
                    }else if($report_result["age"]>=4 && $report_result["age"]<5){
                        $weight[5][4]++;
                    }else if($report_result["age"]>=5){
                        $weight[5][5]++;
                    }else{
                        $weight[5][6]++;
                    }
                }
                if($report_result["is_obesity"]==2){
                    $weight[6][0]++;
                    if($value["gender"]==1){
                        $weight[6][1]++;
                    }else{
                        $weight[6][2]++;
                    }
                    if($report_result["age"]>=3 && $report_result["age"]<4){
                        $weight[6][3]++;
                    }else if($report_result["age"]>=4 && $report_result["age"]<5){
                        $weight[6][4]++;
                    }else if($report_result["age"]>=5){
                        $weight[6][5]++;
                    }else{
                        $weight[6][6]++;
                    }
                }
                if($report_result["is_obesity"]==3){
                    $weight[7][0]++;
                    if($value["gender"]==1){
                        $weight[7][1]++;
                    }else{
                        $weight[7][2]++;
                    }
                    if($report_result["age"]>=3 && $report_result["age"]<4){
                        $weight[7][3]++;
                    }else if($report_result["age"]>=4 && $report_result["age"]<5){
                        $weight[7][4]++;
                    }else if($report_result["age"]>=5){
                        $weight[7][5]++;
                    }else{
                        $weight[7][6]++;
                    }
                }
                if($report_result["is_obesity"]==4){
                    $weight[8][0]++;
                    if($value["gender"]==1){
                        $weight[8][1]++;
                    }else{
                        $weight[8][2]++;
                    }
                    if($report_result["age"]>=3 && $report_result["age"]<4){
                        $weight[8][3]++;
                    }else if($report_result["age"]>=4 && $report_result["age"]<5){
                        $weight[8][4]++;
                    }else if($report_result["age"]>=5){
                        $weight[8][5]++;
                    }else{
                        $weight[8][6]++;
                    }
                }
                if($report_result["is_obesity"]==5){
                    $weight[9][0]++;
                    if($value["gender"]==1){
                        $weight[9][1]++;
                    }else{
                        $weight[9][2]++;
                    }
                    if($report_result["age"]>=3 && $report_result["age"]<4){
                        $weight[9][3]++;
                    }else if($report_result["age"]>=4 && $report_result["age"]<5){
                        $weight[9][4]++;
                    }else if($report_result["age"]>=5){
                        $weight[9][5]++;
                    }else{
                        $weight[9][6]++;
                    }
                }
                if($report_result["is_obesity"]==0){
                    $weight[10][0]++;
                    if($value["gender"]==1){
                        $weight[10][1]++;
                    }else{
                        $weight[10][2]++;
                    }
                    if($report_result["age"]>=3 && $report_result["age"]<4){
                        $weight[10][3]++;
                    }else if($report_result["age"]>=4 && $report_result["age"]<5){
                        $weight[10][4]++;
                    }else if($report_result["age"]>=5){
                        $weight[10][5]++;
                    }else{
                        $weight[10][6]++;
                    }
                }
            }
		}
	
		$data=array(
			'sum_number'=>$sum_number,
			'effective_number'=>$effective_number,
			'invalid_number'=>$invalid_number,
			'physicallevel'=>$physicallevel,
			'age'=>$age,
			'height'=>array($height_sum,$height),
			'weight'=>array($weight_sum,$weight),
			'flexion'=>$flexion,
			'tennis_throw'=>$tennis_throw,
			'standing_long_jump'=>$standing_long_jump,
			'reentry_run'=>$reentry_run,
			'balanceBeam'=>$balanceBeam,
			'continuousJump'=>$continuousJump,
			'heartRate'=>$heartrate
		);
		if($type!=3 && $report_type==1){
			$data["BirthCondition"]=$this->_BirthCondition($report);
		}
        return $data;
	}
	private function _BirthCondition($report){
		//0下标代表有效，1下标代表无效
		$Natural=array(
			'0'=>0,
			'1'=>0,
			'physicallevel'=>array(array(0,0,0),array(0,0,0),array(0,0,0),array(0,0,0),array(0,0,0)),
			'height'=>array(0,0,0,0,0),
			'weight'=>array(0,0,0,0,0),
			'balanceBeam'=>array(0,0,0,0,0),
			'continuousJump'=>array(0,0,0,0,0),
			'heartRate'=>array(0,0,0,0,0),
			'reentry_run'=>array(0,0,0,0,0),
			'standing_long_jump'=>array(0,0,0,0,0),
			'flexion'=>array(0,0,0,0,0),
			'tennis_throw'=>array(0,0,0,0,0),
		);
		$Cesarean=array(
			'0'=>0,
			'1'=>0,
			'physicallevel'=>array(array(0,0,0),array(0,0,0),array(0,0,0),array(0,0,0),array(0,0,0)),
			'height'=>array(0,0,0,0,0),
			'weight'=>array(0,0,0,0,0),
			'balanceBeam'=>array(0,0,0,0,0),
			'continuousJump'=>array(0,0,0,0,0),
			'heartRate'=>array(0,0,0,0,0),
			'reentry_run'=>array(0,0,0,0,0),
			'standing_long_jump'=>array(0,0,0,0,0),
			'flexion'=>array(0,0,0,0,0),
			'tennis_throw'=>array(0,0,0,0,0),
		);
		foreach ($report as $key => $value) {
			if($value["birth_condition"]==1){
				if($value["result"]>0){
					$Natural[0]++;
					if($value["standing_long_jump"]==1){
                		$Natural['standing_long_jump'][0]++;
                	}
                	if($value["standing_long_jump"]==2){
                		$Natural['standing_long_jump'][1]++;
                	}
                	if($value["standing_long_jump"]==3){
                		$Natural['standing_long_jump'][2]++;
                	}
                	if($value["standing_long_jump"]==4){
                		$Natural['standing_long_jump'][3]++;
                	}
                	if($value["standing_long_jump"]==5){
                		$Natural['standing_long_jump'][4]++;
                	}
					if($value["flexion"]==1){
                		$Natural['flexion'][0]++;
                	}
                	if($value["flexion"]==2){
                		$Natural['flexion'][1]++;
                	}
                	if($value["flexion"]==3){
                		$Natural['flexion'][2]++;
                	}
                	if($value["flexion"]==4){
                		$Natural['flexion'][3]++;
                	}
                	if($value["flexion"]==5){
                		$Natural['flexion'][4]++;
                	}
					if($value["reentry_run"]==1){
                		$Natural['reentry_run'][0]++;
                	}
                	if($value["reentry_run"]==2){
                		$Natural['reentry_run'][1]++;
                	}
                	if($value["reentry_run"]==3){
                		$Natural['reentry_run'][2]++;
                	}
                	if($value["reentry_run"]==4){
                		$Natural['reentry_run'][3]++;
                	}
                	if($value["reentry_run"]==5){
                		$Natural['reentry_run'][4]++;
                	}
					if($value["balanceBeam"]==1){
                		$Natural['balanceBeam'][0]++;
                	}
                	if($value["balanceBeam"]==2){
                		$Natural['balanceBeam'][1]++;
                	}
                	if($value["balanceBeam"]==3){
                		$Natural['balanceBeam'][2]++;
                	}
                	if($value["balanceBeam"]==4){
                		$Natural['balanceBeam'][3]++;
                	}
                	if($value["balanceBeam"]==5){
                		$Natural['balanceBeam'][4]++;
                	}
					if($value["tennis_throw"]==1){
                		$Natural['tennis_throw'][0]++;
                	}
                	if($value["tennis_throw"]==2){
                		$Natural['tennis_throw'][1]++;
                	}
                	if($value["tennis_throw"]==3){
                		$Natural['tennis_throw'][2]++;
                	}
                	if($value["tennis_throw"]==4){
                		$Natural['tennis_throw'][3]++;
                	}
                	if($value["tennis_throw"]==5){
                		$Natural['tennis_throw'][4]++;
                	}
					if($value["continuousJump"]==1){
                		$Natural['continuousJump'][0]++;
                	}
                	if($value["continuousJump"]==2){
                		$Natural['continuousJump'][1]++;
                	}
                	if($value["continuousJump"]==3){
                		$Natural['continuousJump'][2]++;
                	}
                	if($value["continuousJump"]==4){
                		$Natural['continuousJump'][3]++;
                	}
                	if($value["continuousJump"]==5){
                		$Natural['continuousJump'][4]++;
                	}
                	if($value["heart_rate"]<80){
                		$Natural['heartRate'][0]++;
                	}
                	if($value["heart_rate"]<=120 && $value["heart_rate"]>=80){
                		$Natural['heartRate'][1]++;
                	}
                	if($value["heart_rate"]>120){
                		$Natural['heartRate'][2]++;
                	}
					if($value["is_obesity"]==5){
                		$Natural['weight'][0]++;
                	}
                	if($value["is_obesity"]==4){
                		$Natural['weight'][1]++;
                	}
                	if($value["is_obesity"]==3){
                		$Natural['weight'][2]++;
                	}
                	if($value["is_obesity"]==2){
                		$Natural['weight'][3]++;
                	}
                	if($value["is_obesity"]==1){
                		$Natural['weight'][4]++;
                	}
                	if($value["height"]==5){
                		$Natural['height'][0]++;
                	}
                	if($value["height"]==4){
                		$Natural['height'][1]++;
                	}
                	if($value["height"]==3){
                		$Natural['height'][2]++;
                	}
                	if($value["height"]==2){
                		$Natural['height'][3]++;
                	}
                	if($value["height"]==1){
                		$Natural['height'][4]++;
                	}
					if($value["sum"]>31){
		            	$Natural["physicallevel"][0][0]++;
		            	if($value["gender"]==1){
		            		$Natural["physicallevel"][0][1]++;
		            	}else{
		            		$Natural["physicallevel"][0][2]++;
		            	}
		            }
		            if($value["sum"]>=28 && $value["sum"]<=31){
	            		$Natural["physicallevel"][1][0]++;
		            	if($value["gender"]==1){
		            		$Natural["physicallevel"][1][1]++;
		            	}else{
		            		$Natural["physicallevel"][1][2]++;
		            	}
		            }
		            if($value["sum"]>=20 && $value["sum"]<=27){
		            	$Natural["physicallevel"][2][0]++;
		            	if($value["gender"]==1){
		            		$Natural["physicallevel"][2][1]++;
		            	}else{
		            		$Natural["physicallevel"][2][2]++;
		            	}
		            }
		            if($value["sum"]<20){
		            	$Natural["physicallevel"][3][0]++;
		            	if($value["gender"]==1){
		            		$Natural["physicallevel"][3][1]++;
		            	}else{
		            		$Natural["physicallevel"][3][2]++;
		            	}
		            }
				}else{
					$Natural[1]++;
					$Natural["physicallevel"][4][0]++;
	            	if($value["gender"]==1){
	            		$Natural["physicallevel"][4][1]++;
	            	}else{
	            		$Natural["physicallevel"][4][2]++;
	            	}
				}
			}else{
				if($value["result"]>0){
					$Cesarean[0]++;
					if($value["standing_long_jump"]==1){
                		$Cesarean['standing_long_jump'][0]++;
                	}
                	if($value["standing_long_jump"]==2){
                		$Cesarean['standing_long_jump'][1]++;
                	}
                	if($value["standing_long_jump"]==3){
                		$Cesarean['standing_long_jump'][2]++;
                	}
                	if($value["standing_long_jump"]==4){
                		$Cesarean['standing_long_jump'][3]++;
                	}
                	if($value["standing_long_jump"]==5){
                		$Cesarean['standing_long_jump'][4]++;
                	}
					if($value["flexion"]==1){
                		$Cesarean['flexion'][0]++;
                	}
                	if($value["flexion"]==2){
                		$Cesarean['flexion'][1]++;
                	}
                	if($value["flexion"]==3){
                		$Cesarean['flexion'][2]++;
                	}
                	if($value["flexion"]==4){
                		$Cesarean['flexion'][3]++;
                	}
                	if($value["flexion"]==5){
                		$Cesarean['flexion'][4]++;
                	}
					if($value["reentry_run"]==1){
                		$Cesarean['reentry_run'][0]++;
                	}
                	if($value["reentry_run"]==2){
                		$Cesarean['reentry_run'][1]++;
                	}
                	if($value["reentry_run"]==3){
                		$Cesarean['reentry_run'][2]++;
                	}
                	if($value["reentry_run"]==4){
                		$Cesarean['reentry_run'][3]++;
                	}
                	if($value["reentry_run"]==5){
                		$Cesarean['reentry_run'][4]++;
                	}
					if($value["balanceBeam"]==1){
                		$Cesarean['balanceBeam'][0]++;
                	}
                	if($value["balanceBeam"]==2){
                		$Cesarean['balanceBeam'][1]++;
                	}
                	if($value["balanceBeam"]==3){
                		$Cesarean['balanceBeam'][2]++;
                	}
                	if($value["balanceBeam"]==4){
                		$Cesarean['balanceBeam'][3]++;
                	}
                	if($value["balanceBeam"]==5){
                		$Cesarean['balanceBeam'][4]++;
                	}
					if($value["tennis_throw"]==1){
                		$Cesarean['tennis_throw'][0]++;
                	}
                	if($value["tennis_throw"]==2){
                		$Cesarean['tennis_throw'][1]++;
                	}
                	if($value["tennis_throw"]==3){
                		$Cesarean['tennis_throw'][2]++;
                	}
                	if($value["tennis_throw"]==4){
                		$Cesarean['tennis_throw'][3]++;
                	}
                	if($value["tennis_throw"]==5){
                		$Cesarean['tennis_throw'][4]++;
                	}
					if($value["continuousJump"]==1){
                		$Cesarean['continuousJump'][0]++;
                	}
                	if($value["continuousJump"]==2){
                		$Cesarean['continuousJump'][1]++;
                	}
                	if($value["continuousJump"]==3){
                		$Cesarean['continuousJump'][2]++;
                	}
                	if($value["continuousJump"]==4){
                		$Cesarean['continuousJump'][3]++;
                	}
                	if($value["continuousJump"]==5){
                		$Cesarean['continuousJump'][4]++;
                	}
                	if($value["heart_rate"]<80){
                		$Cesarean['heartRate'][0]++;
                	}
                	if($value["heart_rate"]<=120 && $value["heart_rate"]>=80){
                		$Cesarean['heartRate'][1]++;
                	}
                	if($value["heart_rate"]>120){
                		$Cesarean['heartRate'][2]++;
                	}
					if($value["is_obesity"]==5){
                		$Cesarean['weight'][0]++;
                	}
                	if($value["is_obesity"]==4){
                		$Cesarean['weight'][1]++;
                	}
                	if($value["is_obesity"]==3){
                		$Cesarean['weight'][2]++;
                	}
                	if($value["is_obesity"]==2){
                		$Cesarean['weight'][3]++;
                	}
                	if($value["is_obesity"]==1){
                		$Cesarean['weight'][4]++;
                	}
					if($value["height"]==5){
                		$Cesarean['height'][0]++;
                	}
                	if($value["height"]==4){
                		$Cesarean['height'][1]++;
                	}
                	if($value["height"]==3){
                		$Cesarean['height'][2]++;
                	}
                	if($value["height"]==2){
                		$Cesarean['height'][3]++;
                	}
                	if($value["height"]==1){
                		$Cesarean['height'][4]++;
                	}
					if($value["sum"]>31){
		            	$Cesarean["physicallevel"][0][0]++;
		            	if($value["gender"]==1){
		            		$Cesarean["physicallevel"][0][1]++;
		            	}else{
		            		$Cesarean["physicallevel"][0][2]++;
		            	}
		            }
		            if($value["sum"]>=28 && $value["sum"]<=31){
	            		$Cesarean["physicallevel"][1][0]++;
		            	if($value["gender"]==1){
		            		$Cesarean["physicallevel"][1][1]++;
		            	}else{
		            		$Cesarean["physicallevel"][1][2]++;
		            	}
		            }
		            if($value["sum"]>=20 && $value["sum"]<=27){
		            	$Cesarean["physicallevel"][2][0]++;
		            	if($value["gender"]==1){
		            		$Cesarean["physicallevel"][2][1]++;
		            	}else{
		            		$Cesarean["physicallevel"][2][2]++;
		            	}
		            }
		            if($value["sum"]<20){
		            	$Cesarean["physicallevel"][3][0]++;
		            	if($value["gender"]==1){
		            		$Cesarean["physicallevel"][3][1]++;
		            	}else{
		            		$Cesarean["physicallevel"][3][2]++;
		            	}
		            }
				}else{
					$Cesarean[1]++;
					$Cesarean["physicallevel"][4][0]++;
	            	if($value["gender"]==1){
	            		$Cesarean["physicallevel"][4][1]++;
	            	}else{
	            		$Cesarean["physicallevel"][4][2]++;
	            	}
				}
			}
            
        }
		$data=array(
			'sum'=>count($report),
			'Natural'=>$Natural,
			'Cesarean'=>$Cesarean,
		);
		return $data;
	}
	//获取学生相关信息
	private function _getStudentInfo($stu_id){
		return M("student")->where("stu_id=".$stu_id)->find();
	}
	//获取班级信息
	private function _getClassInfo($class_id){
		return M("class")->where("class_id=".$class_id)->find();
	}
	//获取园级信息
	private function _getSchoolInfo($school_id){
		return M("school")->where("id=".$school_id)->find();
	}
	//获取市/区级信息
	private function _getAreaInfo($uid){
		return M("user")->where("uid=".$uid)->find();
	}
	public function getSchoolSum($uid){
		$user=model("User")->where("uid=".$uid)->field("uid,city,area,uname")->find();
        $userGroupLink=model("userGroupLink")->where("uid=".$user["uid"])->find();
        if($userGroupLink["user_group_id"]==2){
            $school=M("school")->where("city=".$user["city"])->field("count(id) as sum")->find();
        }else{
            $school=M("school")->where("area=".$user["area"])->field("count(id) as sum")->find();
        }
        $data["sum"]=$school["sum"];
        $data["uname"]=$user["uname"];
        return $data;
	}
}